package pcb.views 
{
	import com.intel.core.UIComponent;
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import pcb.models.LocaleModel;
	import com.intel.utils.TextRender;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class LessonOverView extends UIComponent implements ILocalise 
	{
		private var endOfLessonMc:MovieClip;
		private var dialogTxt:String;
		private var dialogTxt2:String;
		
		private var w:Number = 684;
		private var h:Number = 418;
		
		public function LessonOverView() 
		{
			
		}
		
		override protected function addChildren():void 
		{
			drawBG();
			
			endOfLessonMc = new End_of_Lesson_mc();
			
			var endOfLessonWaypoint:DisplayObject = this.getAppRoot().getChildByName("endOfLessonWaypoint") as MovieClip;
			
			if (endOfLessonWaypoint) {
				endOfLessonMc.x = endOfLessonWaypoint.x;
				endOfLessonMc.y = endOfLessonWaypoint.y;
			}else {
				endOfLessonMc.x = w / 2 - endOfLessonMc.width / 2;
				endOfLessonMc.y = h / 2 - endOfLessonMc.height / 2;
			}
			
			TextRender.createLabel(endOfLessonMc.lessonCompleteTxt2, dialogTxt2);
			
			addChild(endOfLessonMc);
			
		}
		
		private function drawBG():void 
		{
			this.graphics.beginFill(0xffffff, 0.7);
			this.graphics.drawRect(0, 0, w, h);
			this.graphics.endFill();
		}
		
		public function setCurrentLesson(str:String):void 
		{
			TextRender.createLabel(endOfLessonMc.mcEOLText1.lessonCompleteTxt1, dialogTxt + " " + str + ".");
			TextRender.createLabel(endOfLessonMc.lessonCompleteTxt2, dialogTxt2);
		}
		
		/* INTERFACE pcb.views.ILocalise */
		
		public function localiseLabels(localeModel:LocaleModel):void
		{
			dialogTxt = localeModel.getLabelbyId("lessonOver_txt1");
			dialogTxt2 = localeModel.getLabelbyId("lessonOver_txt2");
		}
		
	}
	
}